package com.libc.yygh.common.enums;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * *
 * Created with Description:
 *
 * @version 1.0 <br>
 * @packagename: com.xisoft.common.enums<br>
 * @author: LiBencheng <br>
 * @computer: licheng <br>
 * @date: Created on 2022/7/27 13:57 <br>
 */
public enum DataPoolType
{
    BEE("bee", "cn.beecp.BeeDataSource"),
    C3P0("c3p0", "com.mchange.v2.c3p0.ComboPooledDataSource"),
    DBCP("dbcp", "org.apache.commons.dbcp2.BasicDataSource"),
    DRUID("druid", "com.alibaba.druid.pool.DruidDataSource"),
    HIKARI("hikari", "com.zaxxer.hikari.HikariDataSource"),
    TOMCAT("tomcat", "org.apache.tomcat.jdbc.pool.DataSource"),
    POOLED("pooled", "org.apache.tomcat.jdbc.pool.DataSource");

    public String code;
    public String dataSource;

    DataPoolType(String code, String dataSource)
    {
        this.code = code;
        this.dataSource = dataSource;
    }

    public static List< String > getAllDataPoolType( )
    {
        return new ArrayList< String >()
        {{
            Arrays.stream(DataPoolType.values())
                  .iterator()
                  .forEachRemaining(type -> add(type.code));
        }};
    }
}
